﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows.Forms;

namespace ObservadorPeplau.API
{
    public static class ImageManager
    {
        public static void LoadImageFromUrl(string url, PictureBox pictureBox)
        {
            pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox.Image = LoadImageFromUrl(url);
        }

        public static Image LoadImageFromUrl(string url)
        {
            var request = (HttpWebRequest)WebRequest.Create(url);
            var response = (HttpWebResponse)request.GetResponse();
            var img = Image.FromStream(response.GetResponseStream());
            response.Close();
            return img;
        }
    }
}
